Skip to content

Update minecraft 1.21#675

Closed
JackCrumpLeys wants to merge 180 commits into
valence-rs:mainfrom
JackCrumpLeys:update-minecraft-1.21
Closed

Update minecraft 1.21#675
JackCrumpLeys wants to merge 180 commits into
valence-rs:mainfrom
JackCrumpLeys:update-minecraft-1.21

Conversation

@JackCrumpLeys

@JackCrumpLeys JackCrumpLeys commented Nov 13, 2024

Copy link
Copy Markdown
Contributor

[moved to chunkedge. Given the owner of Valence not being responsive development has continued off of this fork at chunkedge.]

Update to minecraft 1.21.5

What needs to be done:

  • Get all the extracted data integrated and generating code correctly.
  • Getting all the packets renamed, edited and updated. (HUGE thanks to @lukashermansson ❤️) (1.21.3)
    • do this for 1.21.5
  • Getting it to compile with no errors.
    • do this for 1.21.5
  • Get everything new in 1.21.5 though to the state of the rest of the code
    • Encode text as NBT (added JsonText type wrapper for compatibility with disconnect packet)
    • Update the extractor
    • Fix all tests
    • Fix all clippy lints
    • Implement and test all ItemComponents
      - [ ] Add Registry resources where it makes sense (e.g it makes sense to be able to add biomes, because the client can handle new biomes, but it probably doesnt make sense to add new animal variants as the client probably cant handle it (need to verify)) (postponed, some work was done re this but reversed (still in commit history))
    • support the online and offline command packet (supported but commands are not verified yet)
    • Ensure the examples are working & update them
      • advancements.rs
      • anvil_loading.rs
      • bench_players.rs
      • biomes.rs
      • block_entities.rs
      • boss_bar.rs
      • building.rs
      • chest.rs (The inventory itself works, but inventory actions are broken because of the itemcomponent hashing)
      • combat.rs
      • command.rs (currently only online mode/signed messages)
      • cow_sphere.rs
      • ctf.rs
      • custom_npcs.rs
      • death.rs (Respawning takes pretty long, not sure why)
      • entity_hitbox.rs
      • game_of_life.rs
      • parkour.rs
      • particles.rs
      • player_list.rs
      • potions.rs
      • resource_pack.rs
      • server_list_ping.rs
      • terrain.rs
      • text.rs
      • weather.rs
      • world_border.rs (should get updated as it crashes if you run the commands wrong)
    • Check validity of all packets + tests
    • Add high level abstractions for 1.21.5 features
    • Text Decoding seems to be broken (see in player_list example)
  • Running most basic player join scenario.
  • Confirm validity of all non-networking tests.
  • Rewrite and test all of the networking tests.
    - [ ] Research and design comfy abstractions for new ideas in 1.21.x (moved to after basic parity with 1.20.1)
  • Rewrite and run the ctf example maybe with some new features for 1.21.5
    - [ ] Mull over the way networking is done at a base level. (Does 1.21.5 change anything about how the API should operate?)
  • Rewrite all the examples.
  • Start to clean up and review code.
    - [ ] split into smaller easy to review chunks

@JackCrumpLeys JackCrumpLeys marked this pull request as draft November 13, 2024 20:56
@dyc3

dyc3 commented Dec 1, 2024

Copy link
Copy Markdown
Collaborator

I've noticed most of the changes are simple packet renames. Do you think it would make sense to write a codemod tool to update packet names? Could also be useful for users who are upgrading valence.

@Sauronzz

Copy link
Copy Markdown

Is anyone else working on this pr?

@JackCrumpLeys

Copy link
Copy Markdown
Contributor Author

Is anyone else working on this pr?

Just me at the moment. Feel free to help tho.

@maxomatic458

maxomatic458 commented Dec 19, 2024

Copy link
Copy Markdown
Contributor

@JackCrumpLeys will the 1.21 work be done in this PR or on the next-1.21 branch (on the valence repo)?

Im just gonna assume its here since thats ahead of current master.

@JackCrumpLeys

Copy link
Copy Markdown
Contributor Author

@JackCrumpLeys will the 1.21 work be done in this PR or on the next-1.21 branch (on the valence repo)?

Im just gonna assume its here since thats ahead of current master.

I plan to split this into smaller prs. Right now I'm just getting all the packets working then I will look into the logic side of things.

@olukowski

Copy link
Copy Markdown

Hey, let me know if you want any help with this! Probably gonna use valence for my project, and would like to use the latest version.

@JackCrumpLeys

JackCrumpLeys commented Jan 7, 2025

Copy link
Copy Markdown
Contributor Author

@Olle-Lukowski

I would love some help. You can help by simply fixing all the compile errors at the moment. then make sure we have all the packets for 1.21.4 (I think we have all the packets for 1.21.3) then I will make sure the complicated ones all encode/decode correctly.

Right now embarrassingly a file is missing (forgot to git-add) so the packets inspector wont compile (I added a feature to see packets that did not encode/decode) I should have that pushed this late afternoon (~6 hours).

pub enum IDSet<'a> {
NamedSet(Cow<'a, str>),
pub enum IDSet {
NamedSet(String),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this to a String from Cow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably wanted to use ID set in a place where 'a is inappropriate e.g item stack. I honestly don't remember and it can probably be made back into a lifetime.

@nicolube

nicolube commented Jun 7, 2025

Copy link
Copy Markdown

How is this coming along? I've seen that this PR has been quiet for some time.

@maxomatic458

Copy link
Copy Markdown
Contributor

@nicolube im working on 2 PRs on https://github.com/JackCrumpLeys/valence/ atm

waiting for a review from @JackCrumpLeys

@JackCrumpLeys

JackCrumpLeys commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

Work has started back up here!

a list of the next steps:

  • fix:
    • respawn logic
    • chunk logic
  • Add new item component stuff to valence_generated
    • This means implementing deserialise for the massive ItemComponent struct, unfortunately.
  • Find a way to test every packet (perhaps fuzz testing using a typed source like prismarinejs?)
  • Test every packet and implement required fixes
  • Clean added todo comments and create issues for ones that can't be immediately handled
  • Review and add comments where necessary

However, I have been working on this for the past five days, almost 10 hours straight each day, so I will be taking a short break to avoid burnout. I am, however, online most of the time and am happy to respond to any questions.

if you wanna be useful checking out the pr and finding yet unknown bugs is very helpful as long as you provide reproducible steps

@JackCrumpLeys JackCrumpLeys marked this pull request as ready for review March 28, 2026 23:12
@JackCrumpLeys

Copy link
Copy Markdown
Contributor Author

I have marked the PR as ready for review.

The code needs a good look, and I am also interested in any issues with the API and in using anything new. I encourage anyone with projects using Valence to port to this version and share any comments you have.

You can do this by adding this dependency to your Cargo.toml

valence = { git = "https://github.com/JackCrumpLeys/valence", branch = "update-minecraft-1.21", version = "0.2.0-alpha.1" }

@dyc3

dyc3 commented Mar 28, 2026

Copy link
Copy Markdown
Collaborator

I'm hoping this will be the last merge before we set up a new github org. Since I haven't been involved in a while, I'll defer judgement to the community.

Comment on lines +102 to +105
// TODO: verify command signatures.
// As per this gist: https://gist.github.com/kennytv/ed783dd244ca0321bbd882c347892874
// It looks like the client only sends the signed version if a command requires
// it (in vanilla thats /say for example).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should create an issue for this when we create the new github org.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the comented out code in this file can just be thrown out imo aslong as the TODO stays there.

Comment on lines +1076 to +1077

// println!("dropping from slot {}", pkt.slot_idx);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can go

@nicolube

nicolube commented May 2, 2026

Copy link
Copy Markdown

Hello there,

I'm seeing that this this is finaly in this finishing stages, what is the state of this?
I remeber working on component hashing @maxomatic458 did any of that made it into this PR?

@maxomatic458

Copy link
Copy Markdown
Contributor

I remeber working on component hashing @maxomatic458 did any of that made it into this PR?

Not really. But it turned out to not be required (since its just a complete server side thing), as long as our server side item movement simulation is tracked correctly we never need them anyways.

@nicolube

nicolube commented May 2, 2026

Copy link
Copy Markdown

Not really. But it turned out to not be required (since its just a complete server side thing), as long as our server side item movement simulation is tracked correctly we never need them anyways.

Well, ok, but what this not a server-side feature to prevent inventory-desync? At least I know that we had ghost items for year when having fast inventory interactions.

@JackCrumpLeys

Copy link
Copy Markdown
Contributor Author

Not really. But it turned out to not be required (since its just a complete server side thing), as long as our server side item movement simulation is tracked correctly we never need them anyways.

Well, ok, but what this not a server-side feature to prevent inventory-desync? At least I know that we had ghost items for year when having fast inventory interactions.

I think that this turned out to be an optimisation we don't need to repeat, and it's more trouble than it's worth. The inventory desync is a separate issue. Nochian clients still manage inventory the same way we already have code for.

registry_codec: Cow::Borrowed(codec.cached_codec()),
dimension_type_name: dimension_name.clone(),
dimension_name,
dimension_name: Ident::new("overworld").unwrap(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be hard coded like it is?

Comment thread Cargo.toml
resolver = "2"

[workspace.package]
version = "0.2.0-alpha.1+mc.1.20.1"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be updated, maybe in other places also?

@JackCrumpLeys

Copy link
Copy Markdown
Contributor Author

It is likely I will close this soon so that work may continue on another repo. I am open to hearing any objections.

@maxomatic458

Copy link
Copy Markdown
Contributor

@JackCrumpLeys

It is likely I will close this soon so that work may continue on another repo. I am open to hearing any objections.

I have a fix ready for some edge case bug for the item move validation, i think it would be good if we could squeeze that into here before merging.

Ill see if i can make a PR today

jobpaardekooper pushed a commit to ChunkEdge/ChunkEdge that referenced this pull request Jun 21, 2026
This commit is a squash of all commits from the "Update minecraft 1.21" PR on the original Valence report combined with additional final fixes applied later. Please check the links below for the details:

valence-rs/valence#675

5b2290a
#7
#8
#9
#10
#11
#12

Co-authored-by: Jack Crump-Leys <51773589+JackCrumpLeys@users.noreply.github.com>
jobpaardekooper pushed a commit to ChunkEdge/ChunkEdge that referenced this pull request Jun 21, 2026
This commit is a squash of all commits from the "Update minecraft 1.21" PR on the original Valence report combined with additional final fixes applied later. Please check the links below for the details:

valence-rs/valence#675

5b2290a
#7
#8
#9
#10
#11
#12

Co-authored-by: Jack Crump-Leys <51773589+JackCrumpLeys@users.noreply.github.com>
jobpaardekooper added a commit to ChunkEdge/ChunkEdge that referenced this pull request Jun 21, 2026
This commit is a squash of all commits from the "Update minecraft 1.21" PR on the original Valence report combined with additional final fixes applied later. Please check the links below for the details:

valence-rs/valence#675

5b2290a
#7
#8
#9
#10
#11
#12

Co-authored-by: Jack Crump-Leys <51773589+JackCrumpLeys@users.noreply.github.com>
jobpaardekooper added a commit to ChunkEdge/ChunkEdge that referenced this pull request Jun 21, 2026
This commit is a squash of all commits from the "Update minecraft 1.21" PR on the original Valence report combined with additional final fixes applied later. Please check the links below for the details:

valence-rs/valence#675

5b2290a
#7
#8
#9
#10
#11
#12

Co-authored-by: Jack Crump-Leys <51773589+JackCrumpLeys@users.noreply.github.com>
Co-authored-by: Cheezer1656 <118921295+Cheezer1656@users.noreply.github.com>
Co-authored-by: Maxomatic458 <104733404+maxomatic458@users.noreply.github.com>
Co-authored-by: Jack Crump-Leys <jackcrumpleys@gmail.com>
Co-authored-by: Job Paardekooper <jobpaardekooper@gmail.com>
Co-authored-by: SelfMadeSystem <sms@shoghisimon.ca>
Co-authored-by: maxomatic458 <maxomatic458@gmail.com>
Co-authored-by: SelfMadeSystem <sms@shoghisimon.cc>
Co-authored-by: installer <installer@gmail.com>
Co-authored-by: Jack crumpleys <jackcrumpleys@gmail.com>
Co-authored-by: A.L.I.C.E <20363359+alice39@users.noreply.github.com>
Co-authored-by: Lukas Hermansson <lukas@lukashermansson.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.